﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style x:Key="DisableIfLoadingStyle" TargetType="{x:Type FrameworkElement}">
        <Setter Property="IsEnabled" Value="True" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsLoading}" Value="True">
                <Setter Property="IsEnabled" Value="False" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="CollapseIfNotLoadingStyle" TargetType="{x:Type FrameworkElement}">
        <Setter Property="Visibility" Value="Collapsed" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsLoading}" Value="True">
                <Setter Property="Visibility" Value="Visible" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="HideIfNotLoadingStyle" TargetType="{x:Type FrameworkElement}">
        <Setter Property="Visibility" Value="Hidden" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsLoading}" Value="True">
                <Setter Property="Visibility" Value="Visible" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="CollapseIfIsValidStyle" TargetType="{x:Type FrameworkElement}">
        <Setter Property="Visibility" Value="Collapsed" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding IsValid}" Value="False">
                <Setter Property="Visibility" Value="Visible" />                
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="ErrorMessageStyle" TargetType="{x:Type TextBlock}" BasedOn="{StaticResource CollapseIfIsValidStyle}">
        <Setter Property="Foreground" Value="Red" />
        <Setter Property="TextWrapping" Value="Wrap" />
    </Style>
    <Style x:Key="EnableIfSingleItemSelected" TargetType="{x:Type Button}">
        <Setter Property="IsEnabled" Value="False" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding Count}" Value="1">
                <Setter Property="IsEnabled" Value="True" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
    <Style x:Key="EnableIfItemsSelected" TargetType="{x:Type Button}">
        <Setter Property="IsEnabled" Value="True" />
        <Style.Triggers>
            <DataTrigger Binding="{Binding Count}" Value="0">
                <Setter Property="IsEnabled" Value="False" />
            </DataTrigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>